package cn.sf.sufingvideoconsumer.service;

import cn.sf.pojo.Video;
import cn.sf.sufingvideoconsumer.fallback.VideoServiceFallback;
import cn.sf.vo.CommentAll;
import cn.sf.vo.VideoComment;
import cn.sf.vo.VideoDate;
import cn.sf.vo.VideoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "sufing-video-provider",fallback = VideoServiceFallback.class)
public interface VideoService {

    /**
     * 查询视频表及相应的用户信息
     * @param id    视频ID
     * @return
     */
    @RequestMapping("/queryVideoAndUser")
    public Video queryVideoAndUser(@RequestParam("id") long id);

    /**
     * 根据分类查询相关视频
     * @param classify  视频分类
     * @return
     */
    @RequestMapping("/queryOtherVideoList")
    public List<Video> queryOtherVideoList(@RequestParam("classify") long classify);

    /**
     * 点击进入改视频增加一条播放量
     * @param id    视频ID
     * @return
     */
    @RequestMapping("/updVideoPlayNumber")
    public boolean updVideoPlayNumber(@RequestParam("id") long id);

    /**
     * 点击点赞为改视频增加一条点赞量
     * @param id
     * @return
     */
    @RequestMapping("/updVideoLikeNumber")
    public boolean updVideoLikeNumber(@RequestParam("id") long id);

    /**
     * 点击举报未该视频增加一条举报量
     * @param videoId
     * @return
     */
    @RequestMapping("/updVideoReport")
    public boolean updVideoReport(@RequestParam("videoId") long videoId);

    @RequestMapping("/queryIsOrNotCollect")
    public boolean queryIsOrNotCollect(@RequestParam("userId") long userId,
                                       @RequestParam("videoId") long videoId);

    /**
     * 添加收藏:实现事务操作，将为该视频收藏量+1，添加到收藏表中同步执行
     * 取消收藏:实现事务操作，将为该视频收藏量-1，删除收藏表中的数据同步执行
     * @param userId        登录用户ID
     * @param videoId       视频ID
     * @return  返回结果
     * @throws Exception
     */
    @RequestMapping("/VideoCollect")
     String VideoCollect(@RequestParam("userId") long userId,
                               @RequestParam("videoId") long videoId) throws Exception;


    /**
     *
     * 创作中心首页显示信息
     */
    @RequestMapping("/get")
    public List<VideoVo> get(@RequestParam("id")Integer id);

    @RequestMapping("/getAllComment")
    List<VideoComment> getAllComment(@RequestParam("commentVideoId") Integer commentVideoId);

    @PostMapping("/getVideoAll")
    String getVideoAll(@RequestParam("videoTitle") String videoTitle,@RequestParam("videoUserId") Integer videoUserId,@RequestParam("pageNo") Integer pageNo);

    @PostMapping("/updateVideo")
    int updateVideo(Video video);//更改视频稿件信息

    @PostMapping("/deleteVideo")
    int deleteVideo(@RequestParam("videoId") Integer videoId);//删除视频信息


    @RequestMapping("/getVideoDate")
    List<VideoDate> getVideoDate(@RequestParam("userId")Integer userId);

    @RequestMapping("/getComment")
    List<CommentAll> getComment(@RequestParam("commentVideoId") Integer commentVideoId);//查询所有评论

    @PostMapping("/deleteComment")
    int deleteComment(@RequestParam("commentId") Integer commentId);//删除评论


    @RequestMapping("/getVideoIdMAX")
    public int getVideoIdMAX(@RequestParam("id") long id) ;


    @RequestMapping("/addVideo")
    public int addVideo(@RequestBody Video video);
}
